﻿//Write a program that reads a year from the console and checks whether it is a leap. Use DateTime.


using System;

public class LeapYear
{
    public static void Main()
    {
        bool loop = true;
        while (loop)
        {
            Console.Write("Enter a number for the year Year = ");
            try
            {
                int year = int.Parse(Console.ReadLine());
                if (DateTime.IsLeapYear(year))
                {
                    Console.WriteLine("You entered leap year");
                }
                else
                {
                    Console.WriteLine("Year you entered is not a leap year");
                }

                loop = false;
            }
            catch (FormatException)
            {
                Console.WriteLine("Invalid number");
            }
            catch (ArgumentOutOfRangeException)
            {
                Console.WriteLine("The number must be between 1 and 9999!");
            }
        }
    }
}

